<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:30:"./themes/admin/setup\edit.html";i:1741049647;s:39:"D:\phpcode\dpwkt\themes\admin\base.html";i:1741049647;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo $setup['title']; ?></title>
    <meta content="<?php echo $setup['keywords']; ?>" name="keywords" />
    <meta content="<?php echo $setup['description']; ?>" name="description" />
    <?php if($setup['ico'] != null): ?><link rel="shortcut icon" type="image/x-icon"  href="/public/uploads/<?php echo $setup['ico']; ?>"/><?php endif; ?>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/public/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/public/layuiadmin/style/admin.css" media="all">
    <!--CSS引用-->
    
    <!--页面CSS-->
    <!--[if lt IE 9]>
    <script src="/public/static/js/html5shiv.min.js"></script>
    <script src="/public/static/js/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<!--tab标签-->
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">编辑站点信息</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form class="layui-form" action="<?php echo url('admin/setup/update'); ?>" method="post">
                        <div class="layui-form-item">
                            <label class="layui-form-label">网站名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" value="<?php echo $setup['name']; ?>" required  lay-verify="required" placeholder="请输入网站名称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">网站标题</label>
                            <div class="layui-input-block">
                                <input type="text" name="title" value="<?php echo $setup['title']; ?>" required  lay-verify="required" placeholder="请输入网站标题" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">网站关键词</label>
                            <div class="layui-input-block">
                                <textarea name="keywords" placeholder="（选填）请输入网站关键词" class="layui-textarea"><?php echo $setup['keywords']; ?></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">网站描述</label>
                            <div class="layui-input-block">
                                <textarea name="description" placeholder="（选填）请输入网站描述" class="layui-textarea"><?php echo $setup['description']; ?></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">网站图标</label>
                            <div class="layui-input-block">
                                <img id="icosrc" src="<?php if($setup['ico'] != null): ?>/public/uploads/<?php echo $setup['ico']; endif; ?>" onerror="this.src='/public/static/images/wutu.jpg'" style="width:50px;height:50px;margin-right:10px;border-radius:50%">
                                <button type="button" class="layui-btn" id="ico_upload">
                                    <i class="layui-icon">&#xe67c;</i>上传图标（ICO格式）
                                </button>
                                <input type="hidden" name="ico" id="ico" value="<?php echo $setup['ico']; ?>">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">版权信息</label>
                            <div class="layui-input-block">
                                <input type="text" name="copyright" value="<?php echo $setup['copyright']; ?>" required  lay-verify="required" placeholder="请输入版权信息" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">ICP备案号</label>
                            <div class="layui-input-block">
                                <input type="text" name="icp" value="<?php echo $setup['icp']; ?>" placeholder="请输入ICP备案号" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">网站风格</label>
                            <div class="layui-input-block">
                                <select name="template" lay-verify="required" lay-search="">
                                    <option value="./themes/index/" <?php if($setup['template']=='./themes/index/'): ?> selected="selected"<?php endif; ?>>默认风格</option>
                                    <option value="./themes/index_red/" <?php if($setup['template']=='./themes/index_red/'): ?> selected="selected"<?php endif; ?>>红色风格</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">技术支持</label>
                            <div class="layui-input-block">
                                <input type="text" name="technology_name" value="<?php echo $setup['technology_name']; ?>" placeholder="（选填）请输入技术支持" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">技术电话</label>
                            <div class="layui-input-block">
                                <input type="text" name="technology_tel" value="<?php echo $setup['technology_tel']; ?>" placeholder="（选填）请输入技术电话" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">技术网址</label>
                            <div class="layui-input-block">
                                <input type="text" name="technology_url" value="<?php echo $setup['technology_url']; ?>" placeholder="（选填）请输入技术网址" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="*">更新</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!--页面-->

<!--JS引用-->
<script src="/public/static/js/jquery.min.js"></script>
<script src="/public/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/public/layuiadmin/' //静态资源所在路径
    }).extend({
        index: "lib/index" //主入口模块
    }).use('index');
</script>

<script>
    layui.use(['form','layer','upload'], function(){
        var form = layui.form,$ = layui.jquery, layer = layui.layer,upload = layui.upload;

        /**
         * 通用表单提交(AJAX方式)
         */
        form.on('submit(*)', function (data) {
            $.ajax({
                url: data.form.action,
                type: data.form.method,
                data: $(data.form).serialize(),
                success: function (info) {
                    if (info.code === 1) {
                        setTimeout(function () {
                            location.href = info.url;
                        }, 1000);
                    }
                    layer.msg(info.msg);
                }
            });

            return false;
        });

        /**
         * 通用ICO上传
         */
        var uploadInst = upload.render({
            elem: "#ico_upload" //绑定元素
            ,url: "<?php echo url('api/upload/ico'); ?>" //上传接口
            ,accept: 'file' //普通文件
            ,exts: 'ico' //只允许上传ico文件
            ,before: function(obj){ //obj参数包含的信息，跟 choose回调完全一致，可参见上文。
                layer.load(); //上传loading
            }
            ,done: function(res, index, upload){
                layer.closeAll('loading'); //关闭loading
                if (res.error === 0) {
                    $('#icosrc').attr("src","/public/uploads/"+res.url);
                    $('#ico').val(res.url);
                } else {
                    layer.msg(res.message);
                }
            }
            ,error: function(index, upload){
                layer.closeAll('loading'); //关闭loading
            }
        });
    });
</script>

<!--页面JS脚本-->
</body>
</html>

